package com.sntk.organauthomanager.infrastructure.commit.impl;

import com.sntk.organauthomanager.application.dto.ResponseData;
import com.sntk.organauthomanager.infrastructure.commit.MedicalOrganCommit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;

import java.util.List;
@Component("medicalOrganCommitConvert")
public class MedicalOrganCommitConvert {

    @Autowired
    private MedicalOrganCommit medicalOrganCommit;

    public List<String> searchAllocationOrgans(){
        ResponseData<List<String>> responseData = medicalOrganCommit.searchAllocationOrgans();
        if(!responseData.getCode().equals("200")){
            return null;
        }
        if(ObjectUtils.isEmpty(responseData.getData())){
            return null;
        }
        return responseData.getData();
    }

    public List<String> searchAllOrgansSetting(){
        ResponseData<List<String>> responseData = medicalOrganCommit.searchAllOrgansSetting();
        if(!responseData.getCode().equals("200")){
            return null;
        }
        if(ObjectUtils.isEmpty(responseData.getData())){
            return null;
        }
        return responseData.getData();
    }
}
